package cn.hzking.gjmall.adpters.category;

import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import cn.hzking.gjmall.R;
import cn.hzking.gjmall.app.Gjmall;
import cn.hzking.gjmall.bean.CategoryBean;

/**
 * Created by Administrator on 2018/3/1.
 */

public class CategoryListAdapter extends BaseQuickAdapter<CategoryBean.DataBean.CateListBean.SubCategoriesBean, BaseViewHolder> {
    public CategoryListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(final BaseViewHolder helper, CategoryBean.DataBean.CateListBean.SubCategoriesBean item) {
        if (item != null) {
            helper.addOnClickListener(R.id.category_rl_goodlist);
            TextView textView = helper.getView(R.id.category_content_name);
            ImageView imageView = helper.getView(R.id.category_content_image);
            textView.setText(item.getName());
            Glide.with(mContext).load(Gjmall.getOssHost() + item.getImageUrl()).into(imageView);
        }

    }
}
